#pragma once

#include <d3d9.h>
#include <d3dx9.h>
#include <dxerr9.h>
#include "GraphicDef.h"
#include "CMatrix4.h"
#include "CVector3.h"
#include "WareEngineNameSpace.h"

BEGIN_WARE

class CD3D9Mapping
{
public:
	// enum identifying D3D9 tex. types
	//enum eD3DTexType
	//{
	//	/// standard texture
	//	D3D_TEX_TYPE_NORMAL,
	//	/// cube texture
	//	D3D_TEX_TYPE_CUBE,
	//	/// volume texture
	//	D3D_TEX_TYPE_VOLUME,
	//	/// just to have it...
	//	D3D_TEX_TYPE_NONE
	//};

	///// enum identifying D3D9 filter eUsage eType
	//enum eD3DFilterUsage
	//{
	//	/// min filter
	//	D3D_FUSAGE_MIN,
	//	/// mag filter
	//	D3D_FUSAGE_MAG,
	//	/// mip filter
	//	D3D_FUSAGE_MIP
	//};

	//// return a D3D9 equivalent for a Ogre ShadeOptions value
	//static DWORD get(ShadeOptions so);
	///// return a D3D9 equivalent for a Ogre LightTypes value
	//static D3DLIGHTTYPE get(Ogre::Light::LightTypes lightType);
	///// return a D3D9 equivalent for a Ogre TexCoordCalsMethod value
	//static DWORD get(TexCoordCalcMethod m, const D3DCAPS9& caps);
	///// return a D3D9 equivalent for a Ogre TextureAddressingMode value
	//static D3DTEXTUREADDRESS get(TextureUnitState::TextureAddressingMode tam);
	///// return a D3D9 equivalent for a Ogre LayerBlendType value
	//static D3DTEXTURESTAGESTATETYPE get(LayerBlendType lbt);
	///// return a D3D9 equivalent for a Ogre LayerBlendOperationEx value
	//static DWORD get(LayerBlendOperationEx lbo, const D3DCAPS9& devCaps);
	///// return a D3D9 equivalent for a Ogre LayerBlendSource value
	//static DWORD get(LayerBlendSource lbs);
	///// return a D3D9 equivalent for a Ogre SceneBlendFactor value
	//static D3DBLEND get(SceneBlendFactor sbf);
	///// return a D3D9 equivalent for a Ogre CompareFunction value
	//static DWORD get(CompareFunction cf);
	///// return a D3D9 equivalent for a Ogre CillingMode value
	//static DWORD get(CullingMode cm, bool flip);
	///// return a D3D9 equivalent for a Ogre FogMode value
	//static D3DFOGMODE get(FogMode fm);
	///// return a D3D9 equivalent for a Ogre SceneDetailLevel value
	//static D3DFILLMODE get(SceneDetailLevel level);
	///// return a D3D9 equivalent for a Ogre StencilOperation value
	//static DWORD get(StencilOperation op, bool invert = false);
	///// return a D3D9 state eType for Ogre FilterType value
	//static D3DSAMPLERSTATETYPE get(FilterType ft);
	///// return a D3D9 filter option for Ogre FilterType & FilterOption value
	//static DWORD get(FilterType ft, FilterOptions fo, const D3DCAPS9& devCaps, eD3DTexType texType);
	///// return the D3DtexType equivalent of a Ogre tex. eType
	//static eD3DTexType get(TextureType ogreTexType);

	/// return the combination of D3DUSAGE values for Ogre buffer eUsage
	static DWORD get( USAGE eUsage);
	////// Get lock eOptions
	static DWORD get( LOCKOPTIONS eOptions, USAGE eUsage);
	////// Get index eType
	static D3DFORMAT get( IndexType eIndexType );

	/// Get vertex data eType
	static D3DDECLTYPE get( VertexElementType eType );
	/// Get vertex eSemantic
	static D3DDECLUSAGE get( VertexElementSemantic eSem );

	//// Convert matrix to D3D style
	static 	void makeD3DXMatrix( const CMatrix4& mat, D3DXMATRIX& matOut );
	//// Convert matrix from D3D style
	static  void convertD3DXMatrix( const D3DXMATRIX& mat, CMatrix4& matOut );

	static	void makeD3DXVector3( const CVector3& vec, D3DXVECTOR3& vecOut );
	static	void converteD3DXVector3( const D3DXVECTOR3& vec, CVector3& vecOut );

	static D3DFORMAT get( PixelFormat eFormat );

};

END_WARE
